package com.chs.recoginition.controller;


import com.chs.recoginition.pojo.InvitationContent;
import com.chs.recoginition.service.IInvitationContentService;
import com.chs.recoginition.vo.PageRespVo;
import com.chs.recoginition.vo.Result;
import com.chs.recoginition.vo.reqvo.IdentificationPageVo;
import com.chs.recoginition.vo.reqvo.InvitationContentPageVo;
import com.chs.recoginition.vo.respVo.ImageRecognitionRespVo;
import com.chs.recoginition.vo.respVo.InvitationContentRespVo;
import com.chs.recoginition.vo.respVo.UserRespVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * <p>
 * 帖子 前端控制器
 * </p>
 * @author CHS
 * @since 2023-04-08
 */
@RestController
@RequestMapping("/invitationContent")
public class InvitationContentController extends BaseController{
    @Resource
    private IInvitationContentService invitationContentService;


    /**
     * 分页查询
     * @param reqVo
     * @return
     * @throws IOException
     */
    @PostMapping("/findPage")
    Result<PageRespVo<InvitationContentRespVo>> findPage(@RequestBody InvitationContentPageVo reqVo) {
        return Result.success(invitationContentService.findPage(reqVo));
    }

    /**
     * 新增
     * @param reqVo
     * @return
     */
    @PostMapping("/save")
    Result<Void> save(@RequestBody InvitationContentRespVo reqVo){
        UserRespVo user = getUser();
        invitationContentService.save(reqVo, user);
        return Result.success();
    }
    /**
     * 修改
     * @param reqVo
     * @return
     */
    @PostMapping("/modify")
    Result<Void> modify(@RequestBody InvitationContent reqVo){
        UserRespVo user = getUser();
        invitationContentService.modify(reqVo, user);
        return Result.success();
    }

    /**
     * 批量删除
     * @param reqVo
     * @return
     */
    @PostMapping("/remove")
    Result<Void> remove(@RequestBody String reqVo){
        invitationContentService.remove(reqVo);
        return Result.success();
    }
}
